<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>Three.js</title>
    <script src="resources/three.js"></script>
    <script src="resources/OrbitControls.js"></script>
    <script src="resources/MTLLoader.js"></script>
    <script src="resources/OBJLoader.js"></script>
</head>
<body>
  <script>
      //class 1 basic three.js
      var scene=new THREE.Scene();

      /*var geometry=new THREE.BoxGeometry(100,100,100);
      var material=new THREE.MeshLambertMaterial({color:0xff0000});
      var mesh=new THREE.Mesh(geometry,material);
      scene.add(mesh);*/

      var loader=new THREE.OBJLoader();
      loader.load('resources/Jstu_lib.obj',function(obj){
          obj.scale.set(0.1,0.1,0.1);
          scene.add(obj);
          render();

      })

      var light=new THREE.PointLight(0xffffff);
      light.position.set(300,400,200);
      scene.add(light);

      scene.add(new THREE.AmbientLight(0x333333));


      var camera=new THREE.PerspectiveCamera(40, 800/600, 1, 1000);
      camera.position.set(100,200,800);
      camera.lookAt(scene.position);

      var renderer=new THREE.WebGLRenderer();
      renderer.setSize(800, 600);
      document.body.appendChild(renderer.domElement);


      //class2 camera control
      function render(){
          renderer.render(scene,camera);
      }

      var controls=new THREE.OrbitControls(camera);
      controls.addEventListener('change',render);
  </script>
</body>
</html>

